macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

# change the following options as needed
set(FFTW3_VERSION "3.5.8")

if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
  set_and_check(FFTW3_INC_DIR "/opt/homebrew/include")
  set_and_check(FFTW3_LIB_DIR "/opt/homebrew/lib")

elseif(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
  set_and_check(FFTW3_INC_DIR "/usr/include")
  set_and_check(FFTW3_LIB_DIR "/usr/lib/x86_64-linux-gnu")

else()
  message(FATAL_ERROR "Unset operation system for FFTW3. Please edit the FFTW3Config.cmake file.")
endif()

set(FFTW3_LIB fftw3)